/**
 * @ comments will be delete on release.
 * Tool script.
 * @author Thymus.T, 2009-05-30
 */

/**
 * link to a special url.
 */
function linkTo(url, target, win) {
   if(!url) {
      alert("Invaliable url!");
      return;
   }

   if(!win) {
      win = window;
   }
   if(target == "_blank") {
      win.open(url);
   }
   else {
      win.location.href = url;
   }
}

/**
 * Load the XML file and get the document.
 * @param src the file to load
 * @return XML document
 */
function loadXML(src) {
   if(src == null || src == "") {
      return false;
   }

   var xmlDoc = false;

   if(window.ActiveXObject) {
      xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
      xmlDoc.async = false;
      xmlDoc.load(src);
   }
   else if (document.implementation && document.implementation.createDocument) {
      xmlDoc = document.implementation.createDocument("", "", null);
      xmlDoc.async = false;
      xmlDoc.load(src);
   }

   return xmlDoc;
}

/**
 * Return to last page.
 */
function goBack() {
   window.history.back(-1);
}

/**
 * Trim string.
 */
function trim(str) {
   return ltrim(rtrim(str));
}

function ltrim(str) {
   return str;
}

function rtrim(str) {
   return str;
}